home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  27.3 KB  |  977 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    Input Sprocket 1.2
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1996-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __INPUTSPROCKET__
  19. #define __INPUTSPROCKET__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=power
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  51. #define USE_OLD_INPUT_SPROCKET_LABELS 1
  52. #endif  /*  ! defined(USE_OLD_INPUT_SPROCKET_LABELS)  */
  53.  
  54. #ifndef USE_OLD_ISPNEED_STRUCT
  55. #define USE_OLD_ISPNEED_STRUCT 1
  56. #endif  /*  ! defined(USE_OLD_ISPNEED_STRUCT)  */
  57.  
  58. #if TARGET_CPU_PPC
  59. /* ********************* data types ********************* */
  60. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  61. typedef struct OpaqueISpElementReference*  ISpElementReference;
  62. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  63. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  64. typedef OSType                             ISpDeviceClass;
  65. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  66. typedef OSType                             ISpDeviceIdentifier;
  67. typedef OSType                             ISpElementLabel;
  68. typedef OSType                             ISpElementKind;
  69.  
  70. /* *************** errors -30420 to -30439***************** */
  71.  
  72. enum {
  73.     kISpInternalErr                = -30420,
  74.     kISpSystemListErr            = -30421,
  75.     kISpBufferToSmallErr        = -30422,
  76.     kISpElementInListErr        = -30423,
  77.     kISpElementNotInListErr        = -30424,
  78.     kISpSystemInactiveErr        = -30425,
  79.     kISpDeviceInactiveErr        = -30426,
  80.     kISpSystemActiveErr            = -30427,
  81.     kISpDeviceActiveErr            = -30428,
  82.     kISpListBusyErr                = -30429
  83. };
  84.  
  85. /* *************** resources **************** */
  86.  
  87. enum {
  88.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  89.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  90.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  91. };
  92.  
  93. struct ISpApplicationResourceStruct {
  94.     UInt32                             flags;
  95.     UInt32                             reserved1;
  96.     UInt32                             reserved2;
  97.     UInt32                             reserved3;
  98. };
  99. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  100.  
  101.  
  102. enum {
  103.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  104.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  105. };
  106.  
  107. /*
  108.  * ISpDeviceDefinition
  109.  *
  110.  * This structure provides all the available
  111.  * information for an input device within the system
  112.  *
  113.  */
  114. struct ISpDeviceDefinition {
  115.     Str63                             deviceName;                    /* a human readable name of the device */
  116.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  117.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  118.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  119.     UInt32                             flags;                        /* status flags */
  120.     UInt32                             reserved1;
  121.     UInt32                             reserved2;
  122.     UInt32                             reserved3;
  123. };
  124. typedef struct ISpDeviceDefinition ISpDeviceDefinition;
  125.  
  126.  
  127. enum {
  128.     kISpDeviceFlag_HandleOwnEmulation = 1
  129. };
  130.  
  131. /*
  132.  * ISpElementEvent, ISpElementEventPtr
  133.  *
  134.  * This is the structure that event data is passed in.
  135.  *
  136.  */
  137. struct ISpElementEvent {
  138.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  139.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  140.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  141.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  142.     UInt32                             data;                        /* the data for this event */
  143. };
  144. typedef struct ISpElementEvent ISpElementEvent;
  145.  
  146. typedef ISpElementEvent *                ISpElementEventPtr;
  147. /*
  148.  * ISpElementInfo, ISpElementInfoPtr
  149.  *
  150.  * This is the generic definition of an element.
  151.  * Every element must contain this information.
  152.  *
  153.  */
  154. struct ISpElementInfo {
  155.     ISpElementLabel                 theLabel;
  156.     ISpElementKind                     theKind;
  157.     Str63                             theString;
  158.     UInt32                             reserved1;
  159.     UInt32                             reserved2;
  160. };
  161. typedef struct ISpElementInfo ISpElementInfo;
  162.  
  163. typedef ISpElementInfo *                ISpElementInfoPtr;
  164. typedef UInt32                             ISpNeedFlagBits;
  165. #if USE_OLD_ISPNEED_STRUCT
  166. struct ISpNeed {
  167.     Str63                             name;
  168.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  169.     short                             reserved;
  170.     ISpElementKind                     theKind;
  171.     ISpElementLabel                 theLabel;
  172.     ISpNeedFlagBits                 flags;
  173.     UInt32                             reserved1;
  174.     UInt32                             reserved2;
  175.     UInt32                             reserved3;
  176. };
  177. typedef struct ISpNeed ISpNeed;
  178.  
  179. #else
  180. struct ISpNeed {
  181.     Str63                             name;                        /* human-readable string */
  182.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  183.     UInt8                             playerNum;                    /* used for multi-player support */
  184.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  185.     ISpElementKind                     theKind;
  186.     ISpElementLabel                 theLabel;
  187.     ISpNeedFlagBits                 flags;
  188.     UInt32                             reserved1;
  189.     UInt32                             reserved2;
  190.     UInt32                             reserved3;
  191. };
  192. typedef struct ISpNeed ISpNeed;
  193.  
  194. #endif  /* USE_OLD_ISPNEED_STRUCT */
  195.  
  196.  
  197. enum {
  198.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  199.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  200.     kISpNeedFlag_PolledOnly        = 0x00000004,
  201.     kISpNeedFlag_EventsOnly        = 0x00000008,                    /* *** kISpElementKind specific flags ****/
  202.                                                                 /* these are flags specific to kISpElementKind_Button*/
  203.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  204.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  205.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,            /* these are flags specific to kISpElementKind_DPad*/
  206.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  207.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  208.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  209.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  210.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000                    /* there is a axis version of this delta need*/
  211. };
  212.  
  213. /*
  214.  *
  215.  * These are the current built values for ISpDeviceClass
  216.  *
  217.  */
  218.  
  219. enum {
  220.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  221.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  222.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  223.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  224.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  225.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  226.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  227.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl')        /* a device of this class requires ISpTickle*/
  228. };
  229.  
  230. /*
  231.  * These are the current built in ISpElementKind's
  232.  * 
  233.  * These are all OSTypes.
  234.  *
  235.  */
  236.  
  237. enum {
  238.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  239.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  240.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  241.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  242.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  243.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  244. };
  245.  
  246.  
  247. /*
  248.  *
  249.  * These are the current built in ISpElementLabel's
  250.  *
  251.  * These are all OSTypes.
  252.  *
  253.  */
  254. #if USE_OLD_INPUT_SPROCKET_LABELS
  255.  
  256. enum {
  257.                                                                 /* axis */
  258.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  259.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  260.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  261.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  262.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  263.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  264.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  265.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  266.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  267.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  268.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  269.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  270.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  271.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  272.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  273.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn')
  274. };
  275.  
  276. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  277.  
  278.  
  279. enum {
  280.                                                                 /* generic */
  281.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  282.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  283.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  284.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  285.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  286.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  287.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  288.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  289.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  290.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  291.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  292.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  293.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  294.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  295.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  296.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  297.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  298.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  299.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),        /* delta */
  300.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  301.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  302.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  303.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  304.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  305.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  306.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  307.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  308.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,    /* direction pad */
  309.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),
  310.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* buttons */
  311.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  312.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  313.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  314.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt'),    /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  315.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  316.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  317.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  318.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  319.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  320.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  321.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  322.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  323.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  324.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  325.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  326.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  327.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  328.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  329.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  330.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok')
  331. };
  332.  
  333. /*
  334.  *
  335.  * direction pad data & configuration information
  336.  *
  337.  */
  338. typedef UInt32                             ISpDPadData;
  339.  
  340. enum {
  341.     kISpPadIdle                    = 0,
  342.     kISpPadLeft                    = 1,
  343.     kISpPadUpLeft                = 2,
  344.     kISpPadUp                    = 3,
  345.     kISpPadUpRight                = 4,
  346.     kISpPadRight                = 5,
  347.     kISpPadDownRight            = 6,
  348.     kISpPadDown                    = 7,
  349.     kISpPadDownLeft                = 8
  350. };
  351.  
  352. struct ISpDPadConfigurationInfo {
  353.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  354.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  355. };
  356. typedef struct ISpDPadConfigurationInfo ISpDPadConfigurationInfo;
  357.  
  358. /*
  359.  *
  360.  * button data & configuration information
  361.  *
  362.  */
  363. typedef UInt32                             ISpButtonData;
  364.  
  365. enum {
  366.     kISpButtonUp                = 0,
  367.     kISpButtonDown                = 1
  368. };
  369.  
  370. struct ISpButtonConfigurationInfo {
  371.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  372. };
  373. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  374.  
  375. /*
  376.  *
  377.  * axis data & configuration information 
  378.  *
  379.  */
  380. typedef UInt32                             ISpAxisData;
  381.  
  382. #define    kISpAxisMinimum  0x00000000U
  383. #define    kISpAxisMiddle   0x7FFFFFFFU
  384. #define    kISpAxisMaximum  0xFFFFFFFFU
  385.  
  386. struct ISpAxisConfigurationInfo {
  387.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  388. };
  389. typedef struct ISpAxisConfigurationInfo ISpAxisConfigurationInfo;
  390.  
  391. typedef Fixed                             ISpDeltaData;
  392. struct ISpDeltaConfigurationInfo {
  393.     UInt32                             reserved1;
  394.     UInt32                             reserved2;
  395. };
  396. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  397.  
  398. struct ISpMovementData {
  399.     ISpAxisData                     xAxis;
  400.     ISpAxisData                     yAxis;
  401.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  402. };
  403. typedef struct ISpMovementData ISpMovementData;
  404.  
  405.  
  406. enum {
  407.     kISpVirtualElementFlag_UseTempMem = 1
  408. };
  409.  
  410.  
  411. enum {
  412.     kISpElementListFlag_UseTempMem = 1
  413. };
  414.  
  415.  
  416. enum {
  417.     kISpFirstIconSuite            = 30000,
  418.     kISpLastIconSuite            = 30100,
  419.     kISpNoneIconSuite            = 30000
  420. };
  421.  
  422. /* ********************* user level functions ********************* */
  423.  
  424.  
  425. /*
  426.  *
  427.  * startup / shutdown
  428.  *
  429.  */
  430. EXTERN_API_C( OSStatus )
  431. ISpStartup                        (void);
  432.  
  433. /* 1.1 or later*/
  434. EXTERN_API_C( OSStatus )
  435. ISpShutdown                        (void);
  436.  
  437. /* 1.1 or later*/
  438. /*
  439.  *
  440.  * polling
  441.  *
  442.  */
  443. EXTERN_API_C( OSStatus )
  444. ISpTickle                        (void);
  445.  
  446. /* 1.1 or later*/
  447. /********** user interface functions **********/
  448.  
  449. EXTERN_API_C( NumVersion )
  450. ISpGetVersion                    (void);
  451.  
  452. /*
  453.  *
  454.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  455.  *
  456.  */
  457. EXTERN_API_C( OSStatus )
  458. ISpElement_NewVirtual            (UInt32                 dataSize,
  459.                                  ISpElementReference *    outElement,
  460.                                  UInt32                 flags);
  461.  
  462. /*
  463.  *
  464.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  465.  *
  466.  */
  467. EXTERN_API_C( OSStatus )
  468. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  469.                                  ISpNeed *                needs,
  470.                                  ISpElementReference *    outElements,
  471.                                  UInt32                 flags);
  472.  
  473. /*
  474.  *
  475.  * ISpElement_DisposeVirtual(inElement);
  476.  *
  477.  */
  478. EXTERN_API_C( OSStatus )
  479. ISpElement_DisposeVirtual        (UInt32                 count,
  480.                                  ISpElementReference *    inElements);
  481.  
  482. /*
  483.  * ISpInit
  484.  *
  485.  */
  486. EXTERN_API_C( OSStatus )
  487. ISpInit                            (UInt32                 count,
  488.                                  ISpNeed *                needs,
  489.                                  ISpElementReference *    inReferences,
  490.                                  OSType                 appCreatorCode,
  491.                                  OSType                 subCreatorCode,
  492.                                  UInt32                 flags,
  493.                                  short                     setListResourceId,
  494.                                  UInt32                 reserved);
  495.  
  496.  
  497. /*
  498.  * ISpConfigure
  499.  *
  500.  */
  501. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  502. EXTERN_API_C( OSStatus )
  503. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  504.  
  505. /*
  506.  *
  507.  * ISpStop
  508.  *
  509.  */
  510. EXTERN_API_C( OSStatus )
  511. ISpStop                            (void);
  512.  
  513. /*
  514.  *
  515.  * ISpSuspend, ISpResume
  516.  *
  517.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  518.  * ISpResume resumes to the previous state of the system after a suspend call.
  519.  * 
  520.  * Return Codes
  521.  * memFullErr
  522.  *
  523.  */
  524. EXTERN_API_C( OSStatus )
  525. ISpSuspend                        (void);
  526.  
  527. EXTERN_API_C( OSStatus )
  528. ISpResume                        (void);
  529.  
  530. /*
  531.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  532.  *
  533.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  534.  *
  535.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  536.  * buffer - a pointer to your buffer
  537.  * outCount - contains the number of devices in the system
  538.  *
  539.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  540.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  541.  *
  542.  * Return Codes
  543.  * paramErr
  544.  *
  545.  */
  546. EXTERN_API_C( OSStatus )
  547. ISpDevices_Extract                (UInt32                 inBufferCount,
  548.                                  UInt32 *                outCount,
  549.                                  ISpDeviceReference *    buffer);
  550.  
  551. EXTERN_API_C( OSStatus )
  552. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  553.                                  UInt32                 inBufferCount,
  554.                                  UInt32 *                outCount,
  555.                                  ISpDeviceReference *    buffer);
  556.  
  557. EXTERN_API_C( OSStatus )
  558. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  559.                                  UInt32                 inBufferCount,
  560.                                  UInt32 *                outCount,
  561.                                  ISpDeviceReference *    buffer);
  562.  
  563.  
  564. /*
  565.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  566.  *
  567.  * ISpDevices_Activate, ISpDevices_Deactivate
  568.  *
  569.  * This will activate/deactivate a block of devices.
  570.  * inDeviceCount - the number of devices to activate / deactivate
  571.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  572.  *
  573.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  574.  * inClass - the class of devices to activate or deactivate
  575.  *
  576.  * ISpDevice_IsActive
  577.  * inDevice - the device reference that you wish to 
  578.  * outIsActive - a boolean value that is true when the device is active
  579.  *
  580.  * Return Codes
  581.  * paramErr
  582.  *
  583.  */
  584. EXTERN_API_C( OSStatus )
  585. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  586.  
  587. /* 1.1 or later*/
  588. EXTERN_API_C( OSStatus )
  589. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  590.  
  591. /* 1.1 or later*/
  592. EXTERN_API_C( OSStatus )
  593. ISpDevices_Activate                (UInt32                 inDeviceCount,
  594.                                  ISpDeviceReference *    inDevicesToActivate);
  595.  
  596. EXTERN_API_C( OSStatus )
  597. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  598.                                  ISpDeviceReference *    inDevicesToDeactivate);
  599.  
  600. EXTERN_API_C( OSStatus )
  601. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  602.                                  Boolean *                outIsActive);
  603.  
  604. /*
  605.  * ISpDevice_GetDefinition
  606.  *
  607.  *
  608.  * inDevice - the device you want to get the definition for
  609.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  610.  * outStruct - a pointer to where you want the structure copied
  611.  *
  612.  * Return Codes
  613.  * paramErr
  614.  *
  615.  */
  616. EXTERN_API_C( OSStatus )
  617. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  618.                                  UInt32                 inBuflen,
  619.                                  ISpDeviceDefinition *    outStruct);
  620.  
  621.  
  622. /*
  623.  *
  624.  * ISpDevice_GetElementList
  625.  *
  626.  * inDevice - the device whose element list you wish to get
  627.  * outElementList - a pointer to where you want a reference to that list stored
  628.  *
  629.  * Return Codes
  630.  * paramErr
  631.  *
  632.  */
  633. EXTERN_API_C( OSStatus )
  634. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  635.                                  ISpElementListReference * outElementList);
  636.  
  637. /*
  638.  *
  639.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  640.  * no group
  641.  *
  642.  * Return Codes
  643.  * paramErr
  644.  *
  645.  */
  646. EXTERN_API_C( OSStatus )
  647. ISpElement_GetGroup                (ISpElementReference     inElement,
  648.                                  UInt32 *                outGroup);
  649.  
  650. /*
  651.  *
  652.  * takes an ISpElementReference and returns the device that the element belongs 
  653.  * to.
  654.  *
  655.  * Return Codes
  656.  * paramErr if inElement is 0 or outDevice is nil
  657.  *
  658.  */
  659. EXTERN_API_C( OSStatus )
  660. ISpElement_GetDevice            (ISpElementReference     inElement,
  661.                                  ISpDeviceReference *    outDevice);
  662.  
  663. /*
  664.  *
  665.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  666.  * the set of standard information.  You get ISpElementKind specific information
  667.  * through ISpElement_GetConfigurationInfo.
  668.  *
  669.  * Return Codes
  670.  * paramErr if inElement is 0 or outInfo is nil
  671.  *
  672.  */
  673. EXTERN_API_C( OSStatus )
  674. ISpElement_GetInfo                (ISpElementReference     inElement,
  675.                                  ISpElementInfoPtr         outInfo);
  676.  
  677. /*
  678.  *
  679.  *         
  680.  *
  681.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  682.  * 
  683.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  684.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  685.  * will return something error.
  686.  *
  687.  * Return Codes
  688.  * paramErr if inElement or configInfo is nil
  689.  *
  690.  */
  691. EXTERN_API_C( OSStatus )
  692. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  693.                                  UInt32                 buflen,
  694.                                  void *                    configInfo);
  695.  
  696. /*
  697.  *
  698.  * ISpElement_GetSimpleState
  699.  *
  700.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  701.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  702.  * whose data fits in a signed 32 bit integer.
  703.  *
  704.  *
  705.  *
  706.  * Return Codes
  707.  * paramErr if inElement is 0 or state is nil
  708.  *
  709.  */
  710. EXTERN_API_C( OSStatus )
  711. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  712.                                  UInt32 *                state);
  713.  
  714. /*
  715.  *
  716.  * ISpElement_GetComplexState
  717.  *
  718.  * Takes an ISpElementReference and returns the current state of that element.  
  719.  * Will copy up to buflen bytes of the current state of the device into
  720.  * state.
  721.  *
  722.  *
  723.  * Return Codes
  724.  * paramErr if inElement is 0 or state is nil
  725.  *
  726.  */
  727. EXTERN_API_C( OSStatus )
  728. ISpElement_GetComplexState        (ISpElementReference     inElement,
  729.                                  UInt32                 buflen,
  730.                                  void *                    state);
  731.  
  732.  
  733. /*
  734.  * ISpElement_GetNextEvent
  735.  *
  736.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  737.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  738.  * was not enough space to fill in the whole event structure that event will be
  739.  * dequed, as much of the event as will fit in the buffer will by copied and
  740.  * ISpElement_GetNextEvent will return an error.
  741.  *
  742.  * Return Codes
  743.  * paramErr
  744.  *
  745.  */
  746. EXTERN_API_C( OSStatus )
  747. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  748.                                  UInt32                 bufSize,
  749.                                  ISpElementEventPtr     event,
  750.                                  Boolean *                wasEvent);
  751.  
  752. /*
  753.  *
  754.  * ISpElement_Flush
  755.  *
  756.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  757.  * that any events that made it to this layer before the time of the flush call will be flushed and
  758.  * it will not flush any events that make it to this layer after the time when the call has returned.
  759.  * What happens to events that occur during the flush is undefined.
  760.  *
  761.  *
  762.  * Return Codes
  763.  * paramErr
  764.  *
  765.  */
  766. EXTERN_API_C( OSStatus )
  767. ISpElement_Flush                (ISpElementReference     inElement);
  768.  
  769.  
  770.  
  771. /*
  772.  * ISpElementList_New
  773.  *
  774.  * Creates a new element list and returns it in outElementList.  In count specifies 
  775.  * the number of element references in the list pointed to by inElements.  If inCount
  776.  * is non zero the list is created with inCount elements in at as specified by the 
  777.  * inElements parameter.  Otherwise the list is created empty.
  778.  *
  779.  *
  780.  * Return Codes
  781.  * out of memory - If it failed to allocate the list because it was out of memory
  782.                    it will also set outElementList to 0
  783.  * paramErr if outElementList was nil
  784.  *
  785.  *
  786.  * Special Concerns
  787.  *
  788.  * interrupt unsafe
  789.  *
  790.  */
  791. EXTERN_API_C( OSStatus )
  792. ISpElementList_New                (UInt32                 inCount,
  793.                                  ISpElementReference *    inElements,
  794.                                  ISpElementListReference * outElementList,
  795.                                  UInt32                 flags);
  796.  
  797. /*
  798.  * ISpElementList_Dispose
  799.  *
  800.  * Deletes an already existing memory list.  
  801.  *
  802.  *
  803.  * Return Codes
  804.  * paramErr if inElementList was 0
  805.  *
  806.  *
  807.  * Special Concerns
  808.  *
  809.  * interrupt unsafe
  810.  *
  811.  */
  812. EXTERN_API_C( OSStatus )
  813. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  814.  
  815. /*
  816.  * ISpGetGlobalElementList
  817.  *
  818.  * returns the global element list
  819.  *
  820.  * Return Codes
  821.  * paramErr if outElementList is nil
  822.  *
  823.  */
  824. EXTERN_API_C( OSStatus )
  825. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  826.  
  827. /*
  828.  * ISpElementList_AddElement
  829.  *
  830.  * adds an element to the element list
  831.  *
  832.  * Return Codes
  833.  * paramErr if inElementList is 0 or newElement is 0
  834.  * memory error if the system is unable to allocate enough memory
  835.  *
  836.  * Special Concerns
  837.  * interrupt Unsafe
  838.  * 
  839.  */
  840. EXTERN_API_C( OSStatus )
  841. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  842.                                  UInt32                 refCon,
  843.                                  UInt32                 count,
  844.                                  ISpElementReference *    newElements);
  845.  
  846. /*
  847.  * ISpElementList_RemoveElement
  848.  *
  849.  * removes the specified element from the element list
  850.  *
  851.  * Return Codes
  852.  * paramErr if inElementList is 0 or oldElement is 0
  853.  * memory error if the system is unable to allocate enough memory
  854.  *
  855.  * Special Concerns
  856.  * interrupt Unsafe
  857.  * 
  858.  */
  859. EXTERN_API_C( OSStatus )
  860. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  861.                                  UInt32                 count,
  862.                                  ISpElementReference *    oldElement);
  863.  
  864. /*
  865.  * ISpElementList_Extract
  866.  *
  867.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  868.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  869.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  870.  * that number and the size of the array into the buffer.
  871.  *
  872.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  873.  * that have the specified kind and label.
  874.  *
  875.  * Return Codes
  876.  * paramErr
  877.  *
  878.  */
  879. EXTERN_API_C( OSStatus )
  880. ISpElementList_Extract            (ISpElementListReference  inElementList,
  881.                                  UInt32                 inBufferCount,
  882.                                  UInt32 *                outCount,
  883.                                  ISpElementReference *    buffer);
  884.  
  885. EXTERN_API_C( OSStatus )
  886. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  887.                                  ISpElementKind         inKind,
  888.                                  UInt32                 inBufferCount,
  889.                                  UInt32 *                outCount,
  890.                                  ISpElementReference *    buffer);
  891.  
  892. EXTERN_API_C( OSStatus )
  893. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  894.                                  ISpElementLabel         inLabel,
  895.                                  UInt32                 inBufferCount,
  896.                                  UInt32 *                outCount,
  897.                                  ISpElementReference *    buffer);
  898.  
  899. /*
  900.  * ISpElementList_GetNextEvent
  901.  *
  902.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  903.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  904.  * was not enough space to fill in the whole event structure that event will be
  905.  * dequed, as much of the event as will fit in the buffer will by copied and
  906.  * ISpElementList_GetNextEvent will return an error.
  907.  *
  908.  * Return Codes
  909.  * paramErr
  910.  *
  911.  */
  912. EXTERN_API_C( OSStatus )
  913. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  914.                                  UInt32                 bufSize,
  915.                                  ISpElementEventPtr     event,
  916.                                  Boolean *                wasEvent);
  917.  
  918. /*
  919.  *
  920.  * ISpElementList_Flush
  921.  *
  922.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  923.  * that any events that made it to this layer before the time of the flush call will be flushed and
  924.  * it will not flush any events that make it to this layer after the time when the call has returned.
  925.  * What happens to events that occur during the flush is undefined.
  926.  *
  927.  *
  928.  * Return Codes
  929.  * paramErr
  930.  *
  931.  */
  932. EXTERN_API_C( OSStatus )
  933. ISpElementList_Flush            (ISpElementListReference  inElementList);
  934.  
  935. /*
  936.  *
  937.  * ISpTimeToMicroseconds
  938.  *
  939.  *
  940.  * This function takes time from an input sprocket event and converts it
  941.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  942.  *
  943.  *
  944.  * Return Codes
  945.  * paramErr
  946.  *
  947.  */
  948. EXTERN_API_C( OSStatus )
  949. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  950.                                  UnsignedWide *            outMicroseconds);
  951.  
  952.  
  953. #endif  /* TARGET_CPU_PPC */
  954.  
  955.  
  956.  
  957. #if PRAGMA_STRUCT_ALIGN
  958.     #pragma options align=reset
  959. #elif PRAGMA_STRUCT_PACKPUSH
  960.     #pragma pack(pop)
  961. #elif PRAGMA_STRUCT_PACK
  962.     #pragma pack()
  963. #endif
  964.  
  965. #ifdef PRAGMA_IMPORT_OFF
  966. #pragma import off
  967. #elif PRAGMA_IMPORT
  968. #pragma import reset
  969. #endif
  970.  
  971. #ifdef __cplusplus
  972. }
  973. #endif
  974.  
  975. #endif /* __INPUTSPROCKET__ */
  976.  
  977.